{template 'common/header-base'}
{php $frames = buildframes(FRAME);_calc_current_frames($frames);}
<div class="head">
	<nav class="navbar navbar-default" role="navigation">
		<div class="container {if !empty($frames['section']['platform_module_menu']['plugin_menu'])}plugin-head{/if}">
			<div class="navbar-header">
				<a class="navbar-brand" href="{$_W['siteroot']}">
					<img src="{if !empty($_W['setting']['copyright']['blogo'])}{php echo tomedia($_W['setting']['copyright']['blogo'])}{else}./resource/images/logo/logo.png{/if}" class="pull-left" width="110px" height="35px">
					<span class="version">{IMS_VERSION}</span>
				</a>
			</div>
			{if !empty($_W['uid'])}
			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav navbar-left">
					{php global $top_nav}
					{loop $top_nav $nav}
					<li{if FRAME == $nav['name']} class="active"{/if}><a href="{if empty($nav['url'])}{php echo url('home/welcome/' . $nav['name']);}{else}{$nav['url']}{/if}" {if !empty($nav['blank'])}target="_blank"{/if}>{$nav['title']}</a></li>
					{/loop}
				</ul>
				<ul class="nav navbar-nav navbar-right">
					<li class="dropdown">
						<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"><i class="wi wi-user color-gray"></i>{$_W['user']['username']} <span class="caret"></span></a>
						<ul class="dropdown-menu color-gray" role="menu">
							<li>
								<a href="{url 'user/profile'}" target="_blank"><i class="wi wi-account color-gray"></i> 我的账号</a>
							</li>
							{if $_W['isfounder']}
							<li class="divider"></li>
							<li><a href="{url 'cloud/upgrade'}" target="_blank"><i class="wi wi-update color-gray"></i> 自动更新</a></li>
							<li><a href="{url 'system/updatecache'}" target="_blank"><i class="wi wi-cache color-gray"></i> 更新缓存</a></li>
							<li class="divider"></li>
							{/if}
							<li>
								<a href="{url 'user/logout'}"><i class="fa fa-sign-out color-gray"></i> 退出系统</a>
							</li>
						</ul>
					</li>
				</ul>
			</div>
			{else}
			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav navbar-right">
					<li class="dropdown"><a href="{php echo url('user/register');}">注册</a></li>
					<li class="dropdown"><a href="{php echo url('user/login');}">登陆</a></li>
				</ul>
			</div>
			{/if}
		</div>
	</nav>
</div>
{if empty($_COOKIE['check_setmeal']) && !empty($_W['account']['endtime']) && ($_W['account']['endtime'] - TIMESTAMP < (6*86400))} 
<div class="system-tips we7-body-alert" id="setmeal-tips">
	<div class="container text-right">
		<div class="alert-info">
			<a href="{if $_W['isfounder']}{php echo url('user/edit', array('uid' => $_W['account']['uid']));}{else}javascript:void(0);{/if}">
				您的服务有效期限：{php echo date('Y-m-d', $_W['account']['starttime']);} ~ {php echo date('Y-m-d', $_W['account']['endtime']);}.
				{if $_W['account']['endtime'] < TIMESTAMP}
				目前已到期，请联系管理员续费
				{else}
				将在{php echo floor(($_W['account']['endtime'] - strtotime(date('Y-m-d')))/86400);}天后到期，请及时付费
				{/if}
			</a>
			<span class="tips-close" onclick="check_setmeal_hide();"><i class="wi wi-error-sign"></i></span>
		</div>
	</div>
</div>
<script>
	function check_setmeal_hide() {
		util.cookie.set('check_setmeal', 1, 1800);
		$('#setmeal-tips').hide();
		return false;
	}
</script>
{/if} 
<div class="main">
{if !defined('IN_MESSAGE')}
<div class="container">
	{if in_array(FRAME, array('account', 'system', 'adviertisement', 'wxapp')) && !in_array($_GPC['a'], array('news-show', 'notice-show'))}
		{if !empty($_GPC['m']) && !in_array($_GPC['m'], array('keyword', 'special', 'welcome', 'default', 'userapi', 'service')) || defined('IN_MODULE')}
		<a href="javascript:;" class="js-big-main button-to-big color-gray" title="加宽">{if $_GPC['main-lg']}正常{else}宽屏{/if}</a>
		{/if}
	<div class="panel panel-content main-panel-content {if !empty($frames['section']['platform_module_menu']['plugin_menu'])}panel-content-plugin{/if}">
		<div class="content-head panel-heading main-panel-heading">
			{if ($_GPC['c'] != 'cloud' && !empty($_GPC['m']) && !in_array($_GPC['m'], array('keyword', 'special', 'welcome', 'default', 'userapi', 'service'))) || defined('IN_MODULE')}
				<a href="{php echo url('home/welcome/account')}" class="we7-head-back"><i class="wi wi-back-circle"></i></a>
				<span class="we7-head-account"><a href="{php echo url('home/welcome/account')}">{$_W['account']['name']}</a></span>
				{if file_exists(IA_ROOT. "/addons/". $_W['current_module']['name']. "/icon-custom.jpg")}
				<img src="{php echo tomedia("addons/".$_W['current_module']['name']."/icon-custom.jpg")}" class="head-app-logo">
				{else}
				<img src="{php echo tomedia("addons/".$_W['current_module']['name']."/icon.jpg")}" class="head-app-logo">
				{/if}
				<span class="font-lg">{$_W['current_module']['title']}</span>

				<!-- 兼容历史性问题：模块内获取不到模块信息$module的问题-start -->
				{if CRUMBS_NAV == 1}
				{php global $module;}
				{/if}
				<!-- end -->
			{elseif FRAME == 'account'}
				<img src="{php echo tomedia('headimg_'.$_W['account']['acid'].'.jpg')}?time={php echo time()}" class="head-logo">
				<span class="font-lg">{$_W['account']['name']}</span>

				{if $_W['account']['level'] == 1 || $_W['account']['level'] == 3}
					<span class="label label-primary">订阅号</span>{if $_W['account']['level'] == 3}<span class="label label-primary">已认证</span>{/if}
				{/if}
				{if $_W['account']['level'] == 2 || $_W['account']['level'] == 4}
					<span class="label label-primary">服务号</span> {if $_W['account']['level'] == 4}<span class="label label-primary">已认证</span>{/if}
				{/if}
				{if $_W['uniaccount']['isconnect'] == 0}
					<span class="tips-danger">
						<i class="wi wi-warning-sign"></i>未接入微信公众号
						<a href="{php echo url('account/post', array('uniacid' => $_W['account']['uniacid'], 'acid' => $_W['acid']))}">立即接入</a>
					</span>
					{/if}
					<span class="pull-right"><a href="{php echo url('account/display')}" class="color-default we7-margin-left"><i class="wi wi-cut color-default"></i>切换公众号</a></span>
				{if uni_permission($_W['uid'], $_W['uniacid']) != ACCOUNT_MANAGE_NAME_OPERATOR}
					<span class="pull-right"><a href="{php echo url('account/post', array('uniacid' => $_W['account']['uniacid'], 'acid' => $_W['acid']))}"><i class="wi wi-appsetting"></i>公众号设置</a></span>
				{/if}
				<span class="pull-right"><a href="{php echo url('utility/emulator');}" target="_blank"><i class="wi wi-iphone"></i>模拟测试</a></span>
			{/if}
			{if FRAME == 'system'}
				<span class="font-lg"><i class="wi wi-setting"></i> 系统管理</span>
			{/if}
<!-- 			{if FRAME == 'adviertisement'}
				<span class="font-lg"><i class="wi wi-ad"></i>广告联盟</span>
			{/if} -->
			{if FRAME == 'wxapp'}
				<span class="wxapp-name">{$wxapp_info['name']}</span>
				<span class="wxapp-version">{$version_info['version']}</span>
				<div class="pull-right">
					<a href="{php echo url('wxapp/version/display', array('uniacid' => $wxapp_info['uniacid'], 'acid' => $wxapp_info['acid']))}" class="color-default"><i class="wi wi-cut"></i>切换版本</a>
					<a href="{php echo url('wxapp/manage/display', array('uniacid' => $wxapp_info['uniacid'], 'acid' => $wxapp_info['acid']))}" class="color-default"><i class="wi wi-text"></i>管理</a>
					<a href="{php echo url('wxapp/display')}" class="color-default"><i class="wi wi-small-routine"></i>切换小程序</a>
				</div>
			{/if}
		</div>
	<div class="panel-body clearfix main-panel-body {if !empty($_W['setting']['copyright']['leftmenufixed'])}menu-fixed{/if}">
		<div class="left-menu">
			<div class="left-menu-content">
			{if empty($frames['section']['platform_module_menu']['plugin_menu'])}
				<div class="left-menu-top skin-black">
					{if !empty($_GPC['m']) && !in_array($_GPC['m'], array('keyword', 'special', 'welcome', 'default', 'userapi', 'service')) || defined('IN_MODULE')}
						<div class="account-info-name">
							<a href="{php echo url('home/welcome/account')}"><i class="wi wi-back-circle"></i></a>
							<span class="account-name"><a href="{php echo url('home/welcome/account')}">{$_W['account']['name']}</a></span>
						</div>
						<div class="module-info-name">
							{if file_exists(IA_ROOT. "/addons/". $_W['current_module']['name']. "/icon-custom.jpg")}
								<img src="{php echo tomedia("addons/".$_W['current_module']['name']."/icon-custom.jpg")}" class="head-app-logo">
							{else}
								<img src="{php echo tomedia("addons/".$_W['current_module']['name']."/icon.jpg")}" class="head-app-logo">
							{/if}
							<span class="name">{$_W['current_module']['title']}</span>
						</div>
						<!-- 兼容历史性问题：模块内获取不到模块信息$module的问题-start -->
						{if CRUMBS_NAV == 1}
						{php global $module;}
						{/if}
						<!-- end -->
					{elseif FRAME == 'account'}
						<div class="text-center"><img src="{php echo tomedia('headimg_'.$_W['account']['acid'].'.jpg')}?time={php echo time()}" class="head-logo"></div>
						<div class="text-center account-name">{$_W['account']['name']}</div>
						<div class="text-center">
							{if $_W['account']['level'] == 1 || $_W['account']['level'] == 3}
							<span class="label label-primary">订阅号</span>{if $_W['account']['level'] == 3}<span class="label label-primary">已认证</span>{/if}
							{/if}
							{if $_W['account']['level'] == 2 || $_W['account']['level'] == 4}
							<span class="label label-primary">服务号</span> {if $_W['account']['level'] == 4}<span class="label label-primary">已认证</span>{/if}
							{/if}
						</div>
						{if $_W['uniaccount']['isconnect'] == 0}
							<span class="color-red"><i class="wi wi-warning-sign"></i>未接入微信公众号 </span>
							<span class="color-default"><a href="{php echo url('account/post', array('uniacid' => $_W['account']['uniacid'], 'acid' => $_W['acid']))}">立即接入</a></span>
						{/if}
						<div class="text-center operate">
							<a href="{php echo url('utility/emulator');}" target="_blank"><i class="wi wi-iphone" data-toggle="tooltip" data-placement="bottom" title="模拟测试"></i></a>
							{if uni_permission($_W['uid'], $_W['uniacid']) != ACCOUNT_MANAGE_NAME_OPERATOR}
							<a href="{php echo url('account/post', array('uniacid' => $_W['account']['uniacid'], 'acid' => $_W['acid']))}" data-toggle="tooltip" data-placement="bottom" title="公众号设置"><i class="wi wi-appsetting"></i></a>
							{/if}
							<a href="{php echo url('account/display')}"  data-toggle="tooltip" data-placement="bottom" title="切换公众号"><i class="wi wi-changing-over"></i></a>
						</div>
					{/if}

					{if FRAME == 'system'}
						<div class="font-lg title-setting"><i class="wi wi-setting"></i> 系统管理</div>
					{/if}
<!-- 					{if FRAME == 'adviertisement'}
						<div class="font-lg title-ad"><i class="wi wi-ad"></i>广告联盟</div>
					{/if} -->
					{if FRAME == 'wxapp'}
						<div class="font-lg title-ad"><i class="wi wi-ad"></i>小程序</div>
					{/if}
				</div>
				{loop $frames['section'] $frame_section_id $frame_section}
				{if !isset($frame_section['is_display']) || !empty($frame_section['is_display'])}
				<div class="panel panel-menu">
					{if $frame_section['title']}
					<div class="panel-heading">
						<span class="no-collapse">{$frame_section['title']}<i class="wi wi-appsetting pull-right setting"></i></span>
						<span class="" data-toggle="collapse" data-target="#frame-{$frame_section_id}" onclick="util.cookie.set('menu_fold_tag:{$frame_section_id}', util.cookie.get('menu_fold_tag:{$frame_section_id}') == 1 ? 0 : 1)">{$frame_section['title']}<i class="wi wi-down-sign-s pull-right"></i></span>
					</div>
					{/if}

					<ul class="list-group collapse {if !empty($_W['setting']['copyright']['skin']) && $_W['setting']['copyright']['skin'] == 'black'}{if $_GPC['menu_fold_tag:'.$frame_section_id] == 0}in{/if}{else}in{/if}" id="frame-{$frame_section_id}">
						{loop $frame_section['menu'] $menu_id $menu}
						{if !empty($menu['is_display'])}
							{if $menu_id == 'platform_module_more'}
							<li class="list-group-item list-group-more">
								<a href="{url 'profile/module'}" target="_blank"><span class="label label-more">更多应用</span></a>
							</li>
							{else}
							<li class="list-group-item {if $menu['active']}active{/if}">
								<a href="{$menu['url']}" class="text-over" {if $frame_section_id == 'platform_module'}target="_blank"{/if}>
								{if $menu['icon']}
								{if $frame_section_id == 'platform_module'}
								<img src="{$menu['icon']}"/>
								{else}
								<i class="{$menu['icon']}"></i>
								{/if}
								{/if}
								{$menu['title']}
								</a>
							</li>
							{/if}
						{/if}
						{/loop}
					</ul>
				</div>
				{/if}
				{/loop}
			{else}
				<div class="plugin-menu clearfix">
					<div class="plugin-menu-main pull-left">
						<ul class="list-group">
							<li class="list-group-item{if $_GPC['m'] == ''} active{/if}">
								<a href="{php echo url('home/welcome/ext', array('m' => $frames['section']['platform_module_menu']['plugin_menu']['main_module']))}">
									<i class="wi wi-main-apply"></i>
									<div>主应用</div>
								</a>
							</li>
							<li class="list-group-item">
								<div>插件</div>
							</li>
							{loop $frames['section']['platform_module_menu']['plugin_menu']['menu'] $plugin_name $plugin}
							<li class="list-group-item{if $_GPC['m'] == $plugin_name} active{/if}">
								<a href="{php echo url('home/welcome/ext', array('m' => $plugin_name))}">
									<img src="{$plugin['icon']}" alt="" class="img-icon" />
									<div>{$plugin['title']}</div>
								</a>
							</li>
							{/loop}
						</ul>
						{php unset($plugin_name);}
						{php unset($plugin);}
					</div>
					<div class="plugin-menu-sub pull-left">
						{loop $frames['section'] $frame_section_id $frame_section}
						{if !isset($frame_section['is_display']) || !empty($frame_section['is_display'])}
							<div class="panel panel-menu">
								{if $frame_section['title']}
								<div class="panel-heading">
									<span class="no-collapse">{$frame_section['title']}<i class="wi wi-appsetting pull-right setting"></i></span>
									<span class="collapsed" data-toggle="collapse" data-target="#frame0-{$frame_section_id}" aria-expanded="true" aria-controls="frame0-{$frame_section_id}">{$frame_section['title']}<i class="wi wi-down-sign-s pull-right"></i></span>
								</div>
								{/if}
								<ul class="list-group panel-collapse collapse in" id="frame0-{$frame_section_id}">
									{loop $frame_section['menu'] $menu_id $menu}
									{if !empty($menu['is_display'])}
									{if $menu_id == 'platform_module_more'}
									<li class="list-group-item list-group-more">
										<a href="{url 'profile/module'}" target="_blank"><span class="label label-more">更多应用</span></a>
									</li>
									{else}
									<li class="list-group-item {if $menu['active']}active{/if}">
										<a href="{$menu['url']}" class="text-over" {if $frame_section_id == 'platform_module'}target="_blank"{/if}>
										{if $menu['icon']}
											{if $frame_section_id == 'platform_module'}
											<img src="{$menu['icon']}"/>
											{else}
											<i class="{$menu['icon']}"></i>
											{/if}
										{/if}
										{$menu['title']}
										</a>
									</li>
									{/if}
									{/if}
									{/loop}
								</ul>
							</div>
						{/if}
						{/loop}
					</div>
				</div>
			{/if}
			</div>
		</div>
		<div class="right-content">
	{/if}
{/if}
